package LocHot;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-12-05
 * Time: 22:00
 */
public class Demo1 {
    public static void main(String[] args) {

    }

    /**
     * 两数之和
     */
    //
    public static int[] twoSum(int[] nums, int target) {
        // 返回一个数组
        int n = nums.length;
        for(int i = 0;i < n;i++) {
            for(int j = i+1;j < n;j++) {
                if(nums[i] + nums[j] == target) {
                    return new int[]{i,j};
                }
            }
        }
        return new int[0];
    }




}
